<?php
	class LoginControl extends Control{

		function index(){
			$this->display();
		}

		function runlogin(){
			$username=$_POST['uname'];
			$password=md5($_POST['password']);
			$db=M('admin');
			if ($db->where(array('uname'=>$_POST['uname']))->find()) {
				if ($db->where(array('uname'=>$username,'password'=>$password))->find()) {
					$_SESSION['uname']=$username;
					$this->success('登录成功','http://localhost/cms0121/admin.php');
				}else{
					$this->error('密码错误，请重试');
				}
			}
		}

		function loginout(){
			session_unset();
			session_destroy();
			go('http://localhost/cms0121/admin.php/login');	
		}
	}

?>